<?php

class Admin_Form_User extends Zend_Form
{

    public function init()
    {
        $this->setMethod('post');
        $this->setAttrib('class', 'validate-form');
        
        $this->addElement('text','txtUser',array(
        				'label'		=>	'Tên đăng nhập',
        				'required'	=>  true,
        				'class'		=> 	'required'
        				
        		));
       $this->addElement('password','txtPass',array(
        				'label'		=>	'Mật khẩu',
        				'required'	=>  true,
        				'class'		=> 	'required',
       					'minlength' => 	'3'
        				
        		));
       $this->addElement('text','txtName',array(
        				'label'		=>	'Họ tên',
        				'required'	=>  true,
        				'class'		=> 	'required'
        				
        		));
       $this->addElement('text','txtBirth',array(
        				'label'		=>	'Ngày sinh',
        				'required'	=>  true,
        				'class'		=> 	'required'
        				
        		));
       $this->addElement('text','txtEmail',array(
        				'label'		=>	'Email',
        				'required'	=>  true,
        				'class'		=> 	'required email'
        				
        		));
       $this->addElement('select','cbbRole',array(
        				'label'		=>	'Quyền đăng nhập',
        				'required'	=>  true,
        				'class'		=> 	'required',
       					'multiOptions'=> array(
       						'poster'	=> 'poster',
       						'admin'		=> 'admin'
       					)
        		));
    }


	/**
     * 
     * Set action cho form
     * @param unknown_type $actionName: ten cua action
     */
    function addAction($module,$controller, $actionName){
    	$this->setAction(Zend_Controller_Front::getInstance()->getBaseUrl()."/".$module."/".$controller."/".$actionName);
    }
    
    /**
     * 
     * Add nut submit 
     */
    function addSubmitButton($name, $label){
    	$this->addElement('submit',$name,array(
    						'label'		=>	$label,
    						'decorators'=>	array('ViewHelper',array('HtmlTag',array(
    																			'tag' => 'dd' //giu nguyen the dd ko them bat cu the j
    																		)
    														
    															)
    							
    										),
    						'class'		=>	'input-hover uSubmit'	
    					));
    	
    }
    
    function addHiddenId($name,$value){
    	$this->addElement('hidden',$name,array(
			    				'value'	=> $value	
    						));
    }
    
}

